<section id="static_analysis">
    {% if file.pdf %}
        {% if file.pdf.Info %}
        <div>
            <h4>PDF Information</h4>
            <div id="PDF_Info">
                <table class="table table-striped table-bordered">
                    <colgroup>
                        <col width="250" />
                        <col width="*" />
                    </colgroup>
                    {% if file.pdf.Info.Creator %}
                        <tr>
                            <th>Creator</th>
                            <td><span class="mono">{{file.pdf.Info.Creator}}</span></td>
                        </tr>
                    {% endif %}
                    {% if file.pdf.Info.Producer %}
                        <tr>
                            <th>Producer</th>
                            <td><span class="mono">{{file.pdf.Info.Producer}}</span></td>
                        </tr>
                    {% endif %}
                    {% if file.pdf.Info.Author %}
                        <tr>
                            <th>Author</th>
                            <td><span class="mono">{{file.pdf.Info.Author}}</span></td>
                        </tr>
                    {% endif %}
                    <tr>
                        <th>Total Entropy</th>
                        <td><span class="mono">{{file.pdf.Info|getkey:"Total Entropy"}}</span></td>
                    </tr>
                    <tr>
                        <th>Entropy In Streams</th>
                        <td><span class="mono">{{file.pdf.Info|getkey:"Entropy In Streams"}}</span></td>
                    </tr>
                    <tr>
                        <th>Entropy Out of Streams</th>
                        <td><span class="mono">{{file.pdf.Info|getkey:"Entropy Out Streams"}}</span></td>
                    </tr>
                    <tr>
                        <th>Count of "%% EOF"</th>
                        <td><span class="mono">{{file.pdf.Info|getkey:"Count %% EOF"}}</span></td>
                    </tr>
                    <tr>
                        <th>PDF Header</th>
                        <td><span class="mono">{{file.pdf.Info|getkey:"PDF Header"}}</span></td>
                    </tr>
                    <tr>
                        <th>Data After EOF</th>
                        <td><span class="mono">{{file.pdf.Info|getkey:"Data After EOF"}} bytes</span></td>
                    </tr>
                    <tr>
                        <th>File Size</th>
                        <td><span class="mono">{{file.size}} bytes</span></td>
                    </tr>
                    {% if file.pdf.Keywords|getkey:"/Page" %}
                    <tr>
                        <th>Number of Pages</th>
                        <td><span class="mono">{{file.pdf.Keywords|getkey:"/Page"}}</span></td>
                    </tr>
                    {% endif %}
                </table>
            </div>
        </div>
        <hr />
        {% endif %}

        {% if file.pdf.Dates %}
        <div>
            <h4>PDF Date(s)</h4>
            <div id="date">
                <table class="table table-striped table-bordered">
                    <tr>
                        <th>Name</th>
                        <th>Value</th>
                    </tr>
                    {% for date in file.pdf.Dates %}
                    <tr>
                       <td>{{date.name}}</td>
                       <td>{{date.value|datefmt}}</td>
                    </tr>
                    {% endfor %}
                </table>
            </div>
        </div>
        <hr />
        {% endif %}

        {% if file.pdf.Keywords %}
        <div>
            <h4>Keyword Counts</h4>
            <div id="keywords">
                <table class="table table-striped table-bordered">
                    <colgroup>
                        <col width="250" />
                        <col width="*" />
                    </colgroup>
                    <tr>
                        <th>Keyword</th>
                        <th>Count</th>
                    </tr>
                    {% for keyword, count in file.pdf.Keywords.items %}
                    <tr>
                        <td>{{keyword}}</td>
                        <td>{{count}}</td>
                    </tr>
                    {% endfor %}
                </table>
            </div>
        </div>
        <hr />
        {% endif %}
        {% if file.pdf.Annot_URLs %}
        <div>
            <h4>Link Annotation URLs</h4>
            <div class="card card-body">
                {% for url in file.pdf.Annot_URLs %}
                    {{url}}<br />
                {% endfor %}
            </div>
        </div>
        {% endif %}
        {% if file.pdf.JS_URLs %}
        <div>
            <h4>Javascript URLs</h4>
            <div class="card card-body">
                {% for url in file.pdf.JS_URLs %}
                    {{url}}<br />
                {% endfor %}
            </div>
        </div>
        {% endif %}
        {% if file.pdf.JSStreams %}
        <div>
            <h4>Javascript Streams</h4>
            <div id="objects">
                {% for obj in file.pdf.JSStreams %}
                <table class="table table-striped table-bordered">
                <colgroup>
                    <col width="250" />
                    <col width="*" />
                </colgroup>
                <tr>
                    <td>Object ID</td>
                    <td>{{obj|getkey:"Object ID"}}</td>
                </tr>
                <tr>
                    <td>Size</td>
                    {% if obj.Size == 1 %}
                    <td>{{obj.Size}} byte</td>
                    {% else %}
                    <td>{{obj.Size}} bytes</td>
                    {% endif %}
                </tr>
                <tr>
                    <td>Offset</td>
                    <td>{{obj.Offset}}</td>
                </tr>
                <tr>
                    <td>Data</td>
                    <td><a class="accordion-toggle" data-toggle="collapse" data-parent="#accordion" href="#JSStream_{{obj|getkey:'Object ID'}}_Data">Data Extracted</a></td>
                </tr>
                </table>
                <div id="JSStream_{{obj|getkey:'Object ID'}}_Data" class="collapse">
                    <pre>{{obj.Data|linebreaksbr}}</pre>
                </div>
                {% endfor %}
            </div>
        </div>
        {% endif %}

    {% else %}
        Nothing to display.
    {% endif %}
</section>
